package com.lhkj.ct.quartz.model.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lhkj.ct.base.validator.group.ValGroups;
import com.lhkj.ct.quartz.common.enums.JobGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.ibatis.type.EnumTypeHandler;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 定时任务调度表
 * </p>
 *
 * @author jobob
 * @since 2023-09-19
 */
@ApiModel(value="TblJob对象", description="定时任务调度表")
@TableName(value = "tbl_job", autoResultMap = true) // autoResultMap使@TableField的typeHandle生效
public class TblJob implements Serializable {

    private static final long serialVersionUID = 1L;

    @NotBlank(message = "任务id不能为空", groups = {ValGroups.Update.class})
    @ApiModelProperty(value = "任务ID")
    private String id;

    @NotBlank(message = "请输入任务名称", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "任务名称")
    private String jobName;

    @NotNull(message = "请选择任务组", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "任务组")
    @TableField(typeHandler = EnumTypeHandler.class)
    private JobGroup jobGroup;

    @NotBlank(message = "目标字符串不能为空", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "调用目标字符串")
    private String invokeTarget;

    @NotBlank(message = "cron执行表达式不能为空", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "cron执行表达式")
    private String cronExpression;

    @NotBlank(message = "请选择计划执行错误策略", groups = {ValGroups.Insert.class, ValGroups.Update.class})
    @ApiModelProperty(value = "计划执行错误策略（1立即执行 2执行一次 3放弃执行）")
    private String misfirePolicy;

    @ApiModelProperty(value = "是否并发执行（0允许 1禁止）")
    private int concurrent;

    @ApiModelProperty(value = "状态（0正常 1暂停）")
    private String status;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建者")
    private String createBy;

    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.UPDATE)
    @ApiModelProperty(value = "更新者")
    private String updateBy;

    @TableField(fill = FieldFill.UPDATE)
    @ApiModelProperty(value = "更新时间")
    private LocalDateTime updateTime;

    @ApiModelProperty(value = "备注信息")
    private String remark;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getJobName() {
        return jobName;
    }

    public void setJobName(String jobName) {
        this.jobName = jobName;
    }

    public JobGroup getJobGroup() {
        return jobGroup;
    }

    public void setJobGroup(JobGroup jobGroup) {
        this.jobGroup = jobGroup;
    }

    public String getInvokeTarget() {
        return invokeTarget;
    }

    public void setInvokeTarget(String invokeTarget) {
        this.invokeTarget = invokeTarget;
    }

    public String getCronExpression() {
        return cronExpression;
    }

    public void setCronExpression(String cronExpression) {
        this.cronExpression = cronExpression;
    }

    public String getMisfirePolicy() {
        return misfirePolicy;
    }

    public void setMisfirePolicy(String misfirePolicy) {
        this.misfirePolicy = misfirePolicy;
    }

    public int getConcurrent() {
        return concurrent;
    }

    public void setConcurrent(int concurrent) {
        this.concurrent = concurrent;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
}
